<script type="text/javascript">
function save() {
	var parm = $('#editCommodityShowForm').serialize();
	var url = create_url('parkcommodity-saveBatch');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
		sys_submiting_close();
			if ('success' == result) {
				sys_msg('操作成功!');
				sys_load_handle('parkcommodity');
			}
		}
	});
}

function selectCommodity() {
		var url = create_url('parkcommodity-batchCommodityInit');
		var index = $("#index").val();
		var parm = {'index': index};
		$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'750px',height:'500px', open:true});
}

function checked(){
	var flag=true;
	$("#newTable input[type='text']").each(function(){
		if($(this).val().length==0){
			alert("不能有空值哦！");
			flag=false;
			return false
		}
	});
	if(flag){
		save();
	}
}
</script>
<div class="widget" style="float:left; width:720px;">
	<div class="widget-header">
		<h3 class="title"><i class="fontello-icon-th-list-1"></i>批量添加</h3>
	</div>
	<div class="input-group">
		<span class="btn-group">
			<input type="hidden" id="code" name="code" value="${(pc.code)!''}"/>
			<input type="hidden" id="cc" name="cc" value="${(pc.cc)!''}"/>
			<input type="text" id="name" name="name" value="${(pc.name)!''}" readonly="readonly"/>
			<button class="btn btn-primary" onclick="javascript: selectCommodity();" title="选择商品" type="button"><i class="icon-search"></i></button>
			<button class="btn btn-danger" onclick="javascript: $('#name').val(''); $('#cc').val('');" title="重置" type="button"><i class="icon-remove"></i></button>
		</span>
	</div>
	<form id="editCommodityShowForm">
	<table id="newTable" cellpadding="1" cellspacing="1" class="table table-bordered">
			<tr >
				<th>产品名称</th>
				<th>序号</th>
				<th>操作</th>
			</tr>
	</table>
		<a href="javascript:;" class="btn btn-info" onclick="javascript:checked();"><i class="fontello-icon-mail-4"></i>&nbsp;保&nbsp;&nbsp;存
		</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="javascript:;" class="btn btn-info" onclick="javascript:sys_load_handle('parkcommodity');">
		<i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
	</form>
</div>
<input id="index" type="hidden" value="0"/>